# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Contributor: Ross Eldridge <ptepid@ptepid.org>
# Contributor: Ivo(sh) Musil <ivoshm@gmail.com>

pkgname=zssh
pkgver=1.5c
pkgrel=13
pkgdesc="SSH and Telnet client with ZMODEM file transfer capability"
arch=("loong64" "x86_64")
license=("GPL")
url="http://zssh.sourceforge.net/"
depends=("readline")
source=("https://downloads.sourceforge.net/project/zssh/zssh/1.5/$pkgname-$pkgver.tgz"
        'fix_use_ptmx_on_arch.patch'
        'fix_CPPsymlink.patch'
        'source_date_epoch.patch')
sha512sums=('799ce3bbea5e94a800f61e6c38879746a579992396304861b7584b6bad967214b811b6bf9aecb36d9d60a15857377cb2fee80b495ad69778903fc45593efeebd'
            '2d68216fe859d1bcf35e316cf9bf8ed105afb15e27ea00e5ca2e66e433aebf13834fb648e70b544a54a2a135fe65169c6839a67180eb66c724766f4a5ab33725'
            '5e17325b65cd4f48bbb08d4c986ff5789a29d9657b3fb9828183ba489f231124371e37ef718d4793b52898ea1302f29ebad768866a2322f85a75ae8771ccd607'
            '056028c3f6dc31886c9c0b20691e6ceefbf2a44b429ca68f98a73c1e0dc2e61cd183a4cca4de374a01daa86ecc7f55c477e85bd1d98a884b648de5d0180ee5b6')

prepare() {
  cd $pkgname-$pkgver

  patch -p0 < "$srcdir"/fix_use_ptmx_on_arch.patch
  patch -p0 < "$srcdir"/fix_CPPsymlink.patch
  patch -p0 < "$srcdir"/source_date_epoch.patch

  rm -r lrzsz-*
}

build() {
  cd $pkgname-$pkgver
  ./configure --prefix=/usr --mandir='${exec_prefix}/share/man'
  make
}

package() {
  cd $pkgname-$pkgver
  install -dm755 "$pkgdir"/usr/{bin,share/man/man1}
  make exec_prefix="$pkgdir"/usr install
  chmod a+r "$pkgdir"/usr/bin/*
}
